package com.usian.service.impl;

import com.usian.mapper.UserMapper;
import com.usian.pojo.Users;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class UserServiceImpl implements UserService {
  @Autowired
  private UserMapper userMapper;
    @Override
    public List<Users> findAll() {
        return userMapper.selectAll();
    }

  @Override
  public Users findbyid(Integer id) {
    return userMapper.selectByPrimaryKey(id);
  }

  @Override
  public void update(Users user) {
userMapper.updateByPrimaryKeySelective(user);
  }

  @Override
  public void add(Users user) {
userMapper.insertSelective(user);
  }

  @Override
  public void delete(Integer id) {
    userMapper.deleteByPrimaryKey(id);
  }

  @Override
  public void update2(Users users) {
    userMapper.updateByPrimaryKeySelective(users);
  }

}
